package com.wunong.smart.commission.domain.business.impl;

import com.wunong.smart.commission.application.request.BaseCommissionRequest;
import com.wunong.smart.commission.client.enums.CommissionStatusEnum;
import com.wunong.smart.commission.domain.business.FinishCommissionBusinessExt;
import com.wunong.smart.commission.domain.model.CommissionDomain;
import com.wunong.smart.domain.platform.common.VerifyDTO;

/**
 * @author created by zealot.zt
 */
public class DefaultFinishCommissionBusinessExt implements FinishCommissionBusinessExt {

    @Override
    public VerifyDTO canFinish(BaseCommissionRequest request, CommissionDomain domain) {
        boolean canCancel = domain.getStatusEnum() == CommissionStatusEnum.PROCESSING;
        if (!canCancel) {
            return VerifyDTO.unavailable("当前代办不支持结束");
        }

        return VerifyDTO.available();
    }

}
